import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      component: () => import('@/views/login')

    },
    {
      path: '/test',
      name: 'test',
      component: () => import('@/views/test')
    },
    {
      path: '/home',
      redirect:'/workbench',
      name: 'Home',
      component: () => import('@/views/home'),
      children: [
       
        {
          path: '/shopadmin',
          name: 'Shopadmin',
          redirect:'/shoplist',
          component: () => import('@/views/shopadmin/Shopadmin'),
          meta:{title:"商品管理"},
          children: [
            {
              path: '/shoplist',
              name: 'Shoplist',
              component: () => import('@/views/shopadmin/Shoplist'),
              meta: { title: "商品列表" }
            },
          ]
        },
        {
          path: '/workbench',
          name: 'Workbench',
          component: () => import('@/views/Workbench'),
          meta: { title: "工作台" }
        },
        {
          path: '/member',
          name: 'Member',
          component: () => import('@/views/Member'),
          meta: { title: "会员管理/全部会员" }
        },
        {
          path: '/privatekey',
          name: 'Privatekey',
          component: () => import('@/views/Privatekey'),
          meta: { title: "系统设置/秘钥设置" }
        },
        {
          path: '/authority',
          name: 'Authority',
          component: () => import('@/views/Authority'),
          meta: { title: "系统设置/权限管理" }
        },
        {
          path: '/snowpacklist',
          name: 'Snowpacklist',
          component: () => import('@/views/Snowpacklist'),
          meta: { title: "商品管理/雪场分类" }
        },
        {
          path: '/regardsapp',
          name: 'Regardsapp',
          component: () => import('@/views/Regardsapp'),
          meta: { title: "系统设置/关于app" }
        },
        {
          path: '/comment',
          name: 'Comment',
          component: () => import('@/views/Comment'),
          meta: { title: "商品管理/评论管理" }
        },
        {
          path: '/merpar',
          name: 'Merpar',
          component: () => import('@/views/Merpar'),
          meta: { title: "会员管理/详情" }
        },
             
      ]
    },

  ]
})
//全局路由守卫
// Router.beforEach((to,from,next) => { 
  // if(to.path==='/login'){
    // next();
  // }else{
    // alert('请登录')
    // next('/login')
  // }
// 
// })
// 
// 